<?php
namespace App\Models\GoodsRecord;

use App\Contracts\Repositories\GoodsRecordRepository as GoodsRecordRepositoryContract;
use App\Models\GoodsRecord\GoodsRecord;

class GoodsRecordRepository implements GoodsRecordRepositoryContract
{
    public function add($record)
    {
        return GoodsRecord::create($record);
    }

    public function getByConditions($conditions, $withs)
    {
        if (is_array($withs) || is_string($withs) || is_null($withs)) {
            return GoodsRecord::with($withs)->where($conditions)->get();
        } else {
            return null;
        }
    }
}
